{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\LT-054912\surfdrive\Diffusion\dataverse files\Stata commands to replicate figure 4.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}29 Aug 2023, 15:29:29
{txt}
{com}. 
. **Get learning pathway scores
. 
. preserve 
{txt}
{com}. 
. use "pathway scores h4.dta", clear
{txt}
{com}. 
. keep if family_dynamic1=="Greens"
{txt}(53,394 observations deleted)

{com}. 
. bys country_ipol: egen max_path=max(pathways1)
{txt}
{com}. 
. rename pathways1 pathways1_h4 
{res}{txt}
{com}. rename max_path max_path_h4
{res}{txt}
{com}. 
. save "greens_learn_pathway.dta", replace
{txt}{p 0 4 2}
(file {bf}
greens_learn_pathway.dta{rm}
not found)
{p_end}
{p 0 4 2}
file {bf}
greens_learn_pathway.dta{rm}
saved
{p_end}

{com}. 
. restore
{txt}
{com}. 
. use "dataset for analysis.dta", clear
{txt}
{com}. 
. keep if family_dynamic1=="Greens"
{txt}(53,394 observations deleted)

{com}. 
. sort family_dynamic1 country_ipol elec_year
{txt}
{com}. merge family_dynamic1 country_ipol elec_year using "pathway scores h1.dta", sort
{txt}{p}
(you are using old
{bf:merge} syntax; see
{bf:{help merge:[D] merge}} for new syntax)
{p_end}

{com}. drop if _merge==2
{txt}(53,394 observations deleted)

{com}. drop _merge
{txt}
{com}. 
. keep country_ipol elec_year wx_lag_votperfor_ipol family_dynamic1 totentry2 totentry2_ipol pathways1 lag_totentry2_ipol lag_votperfor_ipol votperfor_ipol pathways1
{txt}
{com}. 
. sort family_dynamic1 country_ipol elec_year
{txt}
{com}. merge family_dynamic1 country_ipol elec_year using "greens_learn_pathway.dta", sort
{txt}{p}
(you are using old
{bf:merge} syntax; see
{bf:{help merge:[D] merge}} for new syntax)
{p_end}

{com}. drop if _merge==2
{txt}(0 observations deleted)

{com}. drop _merge
{txt}
{com}. 
. **H1
. 
. bys country_ipol: egen max_path_h1=max(pathways1)
{txt}
{com}. bys country_ipol: tab elec_year if pathways1==max_path_h1

{txt}{hline}
-> country_ipol = Austria

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2015 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Belgium

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2015 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Denmark

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2014 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Finland

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2015 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = France

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1995 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Germany

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2015 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Greece

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1985 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Ireland

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2016 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Italy

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1985 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Luxembourg

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2015 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Netherlands

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2015 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Norway

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2015 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Portugal

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2014 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Spain

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2016 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Sweden

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2015 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Switzerland

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2014 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = United Kingdom

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2014 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}
{com}. bys country_ipol: tab pathways1 if pathways1==max_path_h1

{txt}{hline}
-> country_ipol = Austria

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0665709 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Belgium

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0615349 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Denmark

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
    .054428 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Finland

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0652064 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = France

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0489679 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Germany

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
    .067183 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Greece

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0587819 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Ireland

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0626292 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Italy

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0569053 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Luxembourg

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0656331 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Netherlands

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0653112 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Norway

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0665558 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Portugal

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0520533 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Spain

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0568683 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Sweden

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0680283 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Switzerland

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0555362 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = United Kingdom

  pathways1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0601174 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}
{com}. 
. bys country_ipol: egen max_path_event_h1=max(pathways1) if totentry2_ipol!=0
{txt}(469 missing values generated)

{com}. bys country_ipol: egen max_path_event_h1_v2=max(max_path_event_h1)
{txt}
{com}. 
. drop max_path_event_h1
{txt}
{com}. rename max_path_event_h1_v2 max_path_event_h1
{res}{txt}
{com}. 
. bys country_ipol: egen max_path_event_noimp_h1=max(pathways1) if totentry2!=0 & totentry2!=.
{txt}(469 missing values generated)

{com}. bys country_ipol: egen max_path_event_noimp_h1_v2=max(max_path_event_noimp_h1)
{txt}
{com}. 
. drop max_path_event_noimp_h1
{txt}
{com}. rename max_path_event_noimp_h1_v2 max_path_event_noimp_h1
{res}{txt}
{com}. 
. **H4
. 
. bys country_ipol: egen max_path_event_h4=max(pathways1_h4) if totentry2_ipol!=0
{txt}(469 missing values generated)

{com}. bys country_ipol: egen max_path_event_h4_v2=max(max_path_event_h4)
{txt}
{com}. 
. drop max_path_event_h4
{txt}
{com}. rename max_path_event_h4_v2 max_path_event_h4
{res}{txt}
{com}. 
. bys country_ipol: egen max_path_event_noimp_h4=max(pathways1_h4) if totentry2!=0 & totentry2!=.
{txt}(469 missing values generated)

{com}. bys country_ipol: egen max_path_event_noimp_h4_v2=max(max_path_event_noimp_h4)
{txt}
{com}. 
. drop max_path_event_noimp_h4
{txt}
{com}. rename max_path_event_noimp_h4_v2 max_path_event_noimp_h4
{res}{txt}
{com}. 
. bys family_dynamic1 elec_year: egen wy_lag_totentry2_ipol=sum(lag_totentry2_ipol)
{txt}
{com}. replace wy_lag_totentry2_ipol=wy_lag_totentry2_ipol-lag_totentry2_ipol
{txt}(249 real changes made)

{com}. 
. bys country: tab max_path_event_h1

{txt}{hline}
-> country_ipol = Austria

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0547137 {c |}{res}         43      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         43      100.00

{txt}{hline}
-> country_ipol = Belgium

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0391577 {c |}{res}         43      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         43      100.00

{txt}{hline}
-> country_ipol = Denmark

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0346574 {c |}{res}         43      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         43      100.00

{txt}{hline}
-> country_ipol = Finland

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0558073 {c |}{res}         43      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         43      100.00

{txt}{hline}
-> country_ipol = France

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0489679 {c |}{res}         43      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         43      100.00

{txt}{hline}
-> country_ipol = Germany

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0342794 {c |}{res}         43      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         43      100.00

{txt}{hline}
-> country_ipol = Greece

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0587819 {c |}{res}         40      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         40      100.00

{txt}{hline}
-> country_ipol = Ireland

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0087736 {c |}{res}         43      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         43      100.00

{txt}{hline}
-> country_ipol = Italy

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0569053 {c |}{res}         43      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         43      100.00

{txt}{hline}
-> country_ipol = Luxembourg

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0366557 {c |}{res}         43      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         43      100.00

{txt}{hline}
-> country_ipol = Netherlands

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0431617 {c |}{res}         43      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         43      100.00

{txt}{hline}
-> country_ipol = Norway

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0316858 {c |}{res}         43      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         43      100.00

{txt}{hline}
-> country_ipol = Portugal

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0502173 {c |}{res}         41      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         41      100.00

{txt}{hline}
-> country_ipol = Spain

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0482079 {c |}{res}         38      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         38      100.00

{txt}{hline}
-> country_ipol = Sweden

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0386584 {c |}{res}         43      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         43      100.00

{txt}{hline}
-> country_ipol = Switzerland

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0515955 {c |}{res}         43      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         43      100.00

{txt}{hline}
-> country_ipol = United Kingdom

max_path_ev {c |}
     ent_h1 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
   .0397727 {c |}{res}         43      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         43      100.00

{txt}
{com}. bys country: tab elec_year if max_path_event_h1==pathways1

{txt}{hline}
-> country_ipol = Austria

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1985 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Belgium

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1989 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Denmark

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1993 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Finland

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1985 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = France

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1995 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Germany

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1993 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Greece

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1985 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Ireland

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1987 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Italy

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1985 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Luxembourg

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1993 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Netherlands

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1986 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Norway

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1992 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Portugal

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1995 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Spain

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1995 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Sweden

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1984 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = Switzerland

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1985 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}{hline}
-> country_ipol = United Kingdom

   Election {c |}
       year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       1989 {c |}{res}          1      100.00      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          1      100.00

{txt}
{com}. 
. bys elec_year: egen famentry=sum(totentry2_ipol)
{txt}
{com}. bys elec_year: egen famentrylag=sum(lag_totentry2_ipol) 
{txt}
{com}. bys elec_year: egen famvotlag=sum(lag_votperfor_ipol) 
{txt}
{com}. bys elec_year: egen famvot=sum(votperfor_ipol)
{txt}
{com}. bys elec_year: egen mean_path=mean(pathways1) 
{txt}
{com}. bys elec_year: egen famentry_noimp=sum(totentry2)
{txt}
{com}. 
. gen votperfor=votperfor
{txt}
{com}. replace votperfor=. if totentry2==.
{txt}(0 real changes made)

{com}. 
. bys elec_year: egen famvot_noimp=sum(votperfor)
{txt}
{com}. 
. rename pathways1 path_h1
{res}{txt}
{com}. rename pathways1_h4 path_h4
{res}{txt}
{com}. 
. **Here we implement that pathway scores are only used in years where the family entered in the focal country
. replace path_h1=. if totentry2_ipol==0
{txt}(462 real changes made, 462 to missing)

{com}. replace path_h4=. if totentry2_ipol==0
{txt}(462 real changes made, 462 to missing)

{com}. 
. gen elec_year2=elec_year+0.4
{txt}
{com}. 
. **Median pathway score
. 
. bys elec_year: egen med_path_h1=median(path_h1)
{txt}
{com}. bys elec_year: egen med_path_h4=median(path_h4)
{txt}
{com}. 
. twoway bar med_path_h1 elec_year, barwidth(0.3) col(black)  ///
> || bar med_path_h4 elec_year2, barwidth(0.3) col(gs10) yline(0) ///
> ytitle("Pathway median score") xla(1975(5)2020) ///
> legend(order(1 "Median pathway score emulation" 2 "Median pathway score learning")  pos(6)) ///
> scheme(plottig) name(a, replace) 
{res}{txt}
{com}. 
. **Standardized entry
. 
. egen std_famentry=std(famentry)
{txt}
{com}. egen std_famvot=std(famvot)
{txt}
{com}. 
. sort country elec_year
{txt}
{com}. twoway line std_famentry  elec_year if country_ipol=="France" ,  lcolor(black)  ///
> || line std_famvot elec_year if country_ipol=="France", lcolor(gs10)   ///
> ytitle("Standardized values") ///
> yla(-2 "-2  " -1 "-1  " 0 "0  " 1 "1  " 2 "2  " 3 "3  " ) ///
> xtitle("") xla(1975(5)2020) scheme(plottig) legend(order(1 "Party family entry (most recent election)" 2 "Vote share of party family (most recent election)")  pos(6)) name(b, replace)
{res}{txt}
{com}. 
. graph combine b a, scheme(plottig) col(1)
{res}{txt}
{com}. graph export "Figure4.tif", replace
{txt}{p 0 4 2}
(file {bf}
Figure4.tif{rm}
not found)
{p_end}
{p 0 4 2}
file {bf}
Figure4.tif{rm}
saved as
TIFF
format
{p_end}

{com}. 
. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\LT-054912\surfdrive\Diffusion\dataverse files\Stata commands to replicate figure 4.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}29 Aug 2023, 15:29:34
{txt}{.-}
{smcl}
{txt}{sf}{ul off}